# coding: utf-8
"""
@Time    : 2020/7/5 23:12
@Author  : VillageTony
@FileName: bug_stage.py
@Software: PyCharm
@Blog    ：https://www.diaoyc.cn/
"""
from odoo import fields, models, api


class BugStage(models.Model):
    _name = 'bm.bug.stage'
    _description = 'bug阶段'
    _order = 'sequence, name'  # 默认排序
    _rec_name = 'name'  # 指定一个字段作为该记录的描述

    name = fields.Char('名称')
    desc_detail = fields.Text('描述')
    status = fields.Selection(
        [('waiting', '未开始'),
         ('doing', '进行中'),
         ('closed', '关闭'),
         ('rework', '重测未通过')],
        string='状态'
    )
    document = fields.Html('文档')
    sequence = fields.Integer('sequence')
    percent_pro = fields.Float('进度', (3, 2))
    deadline = fields.Datetime('最晚解决时间')
    create_on = fields.Datetime('创建时间', default=lambda self: fields.Datetime.now())
    delay = fields.Boolean('是否延误')
    image = fields.Binary('图片')
    bug_ids = fields.One2many('bm.bug', 'stages_id', string='bug')
